package com.eattravel.service.impl;

import com.eattravel.mapper.CommentMapper;
import com.eattravel.pojo.Comment;
import com.eattravel.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author glong
 * @date 2019/9/27 19:55
 * 描述：评论信息的加载
 */
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    CommentMapper commentMapper;

    /**
     * 添加评论
     * @param comment
     * @return
     */
    @Override
    public int addComment(Comment comment) {
        // 评论信息分析部分



        if (comment != null){
            return commentMapper.insertComment(comment);
        }

        return 0;
    }

    @Override
    public List<Comment> getCommentByFoodId(String foodId) {
        if (foodId != null){
            return commentMapper.findCommentByFoodId(foodId);
        }
        return null;
    }
}
